/*
 * Copyright (c) 2013, FPX and/or its affiliates. All rights reserved.
 * Use, Copy is subject to authorized license.
 */
package com.pyip.simpleioc;

import java.io.Closeable;

import com.pyip.simpleioc.beans.BeanException;

/**
 * @author yepeng
 * @date 2015年11月4日
 */
public interface SimpleIocContext extends Closeable {

    void close();

    /**
     * @param id
     * @return
     * @throws BeanException 获取不到bean时抛出
     */
    Object getBean(String id) throws BeanException;

    // <T> T getBean(String name, Class<T> requiredType) throws BeansException;

    /**
     * @param requiredType
     * @return
     * @throws BeanException 获取不到bean时抛出
     */
    <T> T getBean(Class<T> requiredType) throws BeanException;

    /**
     * @param name
     * @return
     * @throws BeanException bean不存在时抛出
     */
    boolean isSingleton(String name) throws BeanException;

    /**
     * @param name
     * @return
     * @throws BeanException bean不存在时抛出
     */
    boolean isPrototype(String name) throws BeanException;
}
